package mylooks.greenteam.Registration;

import mylooks.greenteam.R;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;

public class FragmentNamePic extends Fragment 
{
	EditText txtName;
	
	// onCreate
	@Override
	public void onCreate(Bundle savedInstanceState) 
	{
		super.onCreate(savedInstanceState);
	}

	// onActivityCreated
	@Override
	public void onActivityCreated(Bundle savedInstanceState) 
	{
		super.onActivityCreated(savedInstanceState);
	}

	// onCreateView
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) 
	{
		View layoutView = inflater.inflate(R.layout.registration_insert_namepic, container, false);
		
		if(layoutView != null)
			txtName = (EditText)layoutView.findViewById(R.id.txtname);
			
		return layoutView;
	}			
	
	public String GetName()
	{
		if(txtName != null)
		{
			String[] tmp = txtName.getText().toString().split(" "); 
			if(tmp.length > 0 && tmp[0] != "")
				return tmp[0];
		}
		return null;
	}
	
	public String GetSurname()
	{
		if(txtName != null)
		{
			String[] tmp = txtName.getText().toString().split(" "); 
			if(tmp.length > 1 && tmp[1] != "")
				return tmp[1];
		}
		return null;
	}
}
